Ext.define('AmpleHarvest.objects.importrequesttool.view.ImportRequest',
{
	extend : 'Ext.panel.Panel',
	alias  : 'widget.ampleharvest-objects-importrequesttool-view-importrequest',
	requires :
    [
     	'AmpleHarvest.objects.importrequesttool.view.toolbar.ImportRequestToolbar',
     	'AmpleHarvest.eventHandler.cWindowEvents',
     	'Ext.tab.Panel'
     
     ],
     title : "Import Request Manager",
     minHeight : 400,
     minWidth : 600,
     layout : 'fit',
     iconClas : 'window-harvest-manager-icon',
     applyTo  : 'Window',
     tbar        :
     {
        xtype : 'ampleharvest-objects-importrequesttool-view-toolbar-importrequesttoolbar'
     },
     
     initComponent : function()
     {
    	 if ( obj_config.C_STR_APPLICATION == 'IRT' )
     	 {
     		this.title=null;
     	 }
    	 var obj_This = this;
    	 
    	 Ext.QuickTips.init();
    	 
    	 
    	 
    	 this.callParent();
    	 
    	 this.m_obj_SystemEvents = Ext.create(
	            "AmpleHarvest.eventHandler.cWindowEvents",
	            {
	               m_obj_MsgBus   : obj_This,
	               m_obj_Desktop  : obj_This
	            }
	      );
    	 
    	 this.m_obj_Tabs = Ext.create("Ext.tab.Panel",
		 {
		    autoLoad : false
		 });
    	 
    	 Ext.Ajax.request({
	       url: obj_config.C_STR_EXTERNAL_PATH+'/rest/harvestrequest/GetHarvestPermissions.php',
	       method  : "GET",
	       scope: this,
	       success: function(response){
	           var nameJsonArray = JSON.parse(response.responseText);
	           // Set Permisions
	           this.bool_EditOwnS1 = nameJsonArray.data.HR_EDIT_OWN_STAGE1;
	           this.bool_EditOwnS2 = nameJsonArray.data.HR_EDIT_OWN_STAGE2;
	           this.bool_EditAllS1 = nameJsonArray.data.HR_EDIT_ALL_STAGE1;
	           this.bool_EditAllS2 = nameJsonArray.data.HR_EDIT_ALL_STAGE2;
	           this.bool_DeactivateAll = nameJsonArray.data.HR_REQUEST_DEACTIVATE_ALL;
	           this.bool_DeactivateOwn = nameJsonArray.data.HR_REQUEST_DEACTIVATE_OWN;
	           this.bool_ViewAll = nameJsonArray.data.HR_VIEW_ALL;
	           
	           this.m_obj_Tabs.add(Ext.create("AmpleHarvest.objects.importrequesttool.view.tab.AllImportRequest", nameJsonArray) );
	           this.m_obj_Tabs.add(Ext.create("AmpleHarvest.objects.importrequesttool.view.tab.MyImportRequests", nameJsonArray) );
	           this.m_obj_Tabs.add(Ext.create("AmpleHarvest.objects.importrequesttool.view.tab.TaskedImportRequests", nameJsonArray) );
	           

	           this.add(this.m_obj_Tabs);
	           this.m_obj_Tabs.setActiveTab(0);
	           //Ext.getCmp('action-column-perms').items = 
	       }
	      });
    	 
     }
     
     
});